﻿using SuperX.Common.Helper;
using System;
using System.Collections.Generic;
using System.Text;

namespace SuperX.Helper.Rule
{
    /// <summary>
    /// 校验IP
    /// </summary>
    public class IPRule : IRule
    {
        NotNullRule notNullRule = new NotNullRule();
        public bool IsValidValue(object value, out string outMsg)
        {
            if (!notNullRule.IsValidValue(value, out outMsg))
            {
                return false;
            }
            if (!IPUtil.IsValid(value))
            {
                outMsg = string.Format($"IP非法：{value}");
                return false;
            }
            return true;
        }
    }
}
